﻿namespace Liger.Web.UI
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class GridCheckboxSettingsBuilder
    {
        private readonly GridCheckboxSettings checkbox;
        public GridCheckboxSettingsBuilder(GridCheckboxSettings checkbox)
        {
            this.checkbox = checkbox;
        }

        /// <summary>
        /// 是否启用复选框模式
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public GridCheckboxSettingsBuilder Enabled(bool value)
        {
            this.checkbox.Enabled = value;
            return this;
        }

        /// <summary>
        /// 复选框 初始化函数
        /// </summary>
        public GridCheckboxSettingsBuilder IsChecked(string functionName)
        {
            this.checkbox.IsChecked = () => functionName;
            return this;
        }

        /// <summary>
        /// 复选框 初始化函数
        /// </summary>
        public GridCheckboxSettingsBuilder IsChecked(Func<string> function)
        {
            this.checkbox.IsChecked = function;
            return this;
        }


        /// <summary>
        /// 复选框模式时，是否只允许点击复选框才能选择行
        /// </summary>
        public GridCheckboxSettingsBuilder SelectRowButtonOnly(bool value)
        {
            this.checkbox.SelectRowButtonOnly = value;
            return this;
        }
    }
}
